home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 11
/
Cream of the Crop 11-2.iso
/
extra_2
/
pre_view.zip
/
README.TXT
< prev
next >
Wrap
Text File
|
1995-10-30
|
7KB
|
141 lines
ReadMe.txt file from Preview.Zip
Author: Brad Tharalson, CIS 72030,3045
Create a new directory, install using: pkunzip -d preview.
If you don't use the '-d' option, all
the files end up in the same directory
and it will need to be re-installed.
PrnInit.txt Contains list of printers and Queues they can attach to.
Loaded during StartLinePrinter(). If your printer is not on
the list, the program should still work correctly.
In the main install directory is the project file (PrnPrev.dpr) that shows
the use of the wPreview unit. Open the project, ignore the message, if any,
that says: Error Reading Symbol File. Build and Run the program.
It starts with a Select Printer form, if your current printer is not shown
then please select it. Make sure the "Preview Reports Before Printing"
checkbox is selected.
Under the "Preview Samples" menu choice, select any choice, these consist
of several prepared command list files that are then "Played Back", more
later. When on the Preview form, you can use the popup menu attached to the
right button to select the choices at the top of the Preview form if they
should scroll off the forms canvas.
For the "View Blue Print" selection, there are two bitmaps involved. The full
size image is 2200x1700 (470k), the "Select" image is only 613x337. The
"Select" image appears first, click anywhere on this image and wait
a few seconds, the appropriate area on the full image will come into view.
You can then use "Up","Down", etc., buttons to move around the image or if
you click on the full image the "Select" image reappears and you can select
a new area to view, in essence, hop back and forth.
Before you try the "Print Blue Print" test, make sure your printer resolution
is less than or equal to 300 DPI. I've had problems with higher resolutions.
wPreview Unit Concept
---------------------
I tried to find a unit I could use to give my software the same "Print With
Preview" capability found in commercial packages. Unfortunately I couldn't
find something to fit my needs.
Printing is very easy in Delphi using their supplied Printers unit. For
years my end-users have been use to being able to view plain text reports
on the screen before printing. First, I wrote the routine to send each
canvas page to the screen or printer as they have chosen. Of course, they
wanted to be able to hop around among different pages.
So I decided that I would capture all of parameters passed into the routines
I already use for printing. Search for AddCommand() lines in wPreview.pas.
If they wanted it to go directly to the printer the parameters are not saved,
and the commands are immediately processed.
Each group of routines for a page are kept separate in their own TStringList
object, at any time a single page or all pages can be passed to the
PlayBackPage routine and it will clear the current drawing canvas and
process the commands in the TStringList in the same order they were created.
These TStringList objects can also be saved to a file for later playback,
see the SaveCommands and PrintCommandFile routines. Most of the sample
choices are just command files that are being played back, these were
generated using our Job Costing system. The saving occured in the PlayBackPage
routine, search for SaveCommands(), you'll see where I commented it out.
I have included the Delphi code used to generate the Command files that are
played back on the sample menu. Search for "StartDoc" in the files below:
Command File Menu Choice
------------ -----------
DemoRout.txt Preview Routing Card, see Samples/RoutCard.pas
DemoJob.txt Preview Job Cost, see Samples/JBdet.pas
DemoInfo.txt Preview Job Due/Ship, see Samples/JCcommon.pas
Printing sequence follow:
1. Use "Select Printer" menu choice under "File" menu to set the print
destination and whether to preview reports before printing.
2. Create "Lpr" object, use its methods to create your print file.
3. "TPreview" form (Minimized) is created whether you want Report
Preview or not. This is nice because you will see icons showing
all the reports you are currently formatting.
4. When you end your series of print commands with StopDoc(), one of two
things will happen:
a. Preview Selected: TPreview form is Maximized, first page appears.
TPreview form stays open until you close it.
Lpr --> Commands List --> TPreview form created -->
Lpr (destroyed) --> TPreview uses its own Lpr object to
view and/or print pages as needed.
b. No Preview Selected: TPreview form is removed after printing.
Lpr --> Direct To Printer --> Lpr (destroyed)
Code Sample: Print Customer Names List (simplified)
-----------
procedure CustLIst;
var lpp:Lpr; { Lpr is in unit wPreview.pas }
tdb:oDB: { from DBserver.pas unit in Clp2Dlfi directory }
begin
lpp:=Lpr.create;
tdb:=nil;
dbUse(tdb,'cust'); { open Cust.dbf }
with lpp do begin
SetDestination;
StartDoc(for8x11,'Customer List');
while not tdb.eof do begin
{ have to use "lpp.writeln" because WriteLn is built-in to Delphi,
and it takes precedence if no qualifier }
lpp.writeln(tdb.s('cust')+' ('+tdb.s('cust_no')+')');
end;
StopDoc;
end;
dbClose(tdb);
lpp.free;
end;
SetDestination should only be called once just before starting a series
of StartDoc-StopDoc sequences. You can use the wPreview.pas unit to
print several reports at the same time, some you may have wanted
to preview when done, others you may be sending to one or more different
printers.
Note: there is no BTPrint.pas file for the BTPrint.dcu file. I was having
some problems with the GetCanvas routine in Printers.pas in the VCL.
So I moved the FCanvas declaration to the public section and set it to
Nil in the TPrinterCanvas.Create routine. I don't think I can give you
this changed code because it's Borland's. But I think I can give you
the compiled unit which is all that is really necessary. If you
accidently remove the BTPrint.dcu unit, you can copy BTPrint.ucd to
BTPrint.dcu.
Hope the samples and the wPreview.pas routines can save you some time.
Brad Tharalson
72030,3045